<?php
/*
 * Главная страница
 */
class Page extends BasicModel {
	public function __construct(Core $Site) {
		parent::__construct($Site);
	}
	public function makePage() {
		header('Content-type: text/javascript');
		if (!isset($this->URL->Params['id'])) {$this->NoInform();}
		$Select = $this->MySQL->Select('SELECT `PARAMS`, `ID` FROM `{p}informers` WHERE `MD5` = "'.$this->URL->Params['id'].'"');
		
		if (!$Select && !isset($Select['MD5'])) {$this->NoInform();}
		$Params = json_decode($Select['PARAMS'], TRUE);
		$Params['MD5'] = $this->URL->Params['id'];
		$Params['ID'] = $Select['ID'];
		if ($Params['sel_inf'] == '#inf_1') {$this->Informer_1($Params);}
		elseif ($Params['sel_inf'] == '#inf_2') {$this->Informer_2($Params);}
		elseif ($Params['sel_inf'] == '#inf_3') {$this->Informer_3($Params);}
		elseif ($Params['sel_inf'] == '#inf_4') {$this->Informer_4($Params);}
		elseif ($Params['sel_inf'] == '#inf_5') {$this->Informer_5($Params);}
		exit;
	}
	private function NoInform() {
		exit;
	}
	private function Informer_1(&$Params) {
		$NT = 'NIGHT';$H = (int)date('H');
		$s = 's';
		if ($H >= 0 && $H < 6) {$NT = 'NIGHT';$s = 'n';}
		elseif ($H >= 6 && $H < 12) {$NT = 'MORNING';}
		elseif ($H >= 12 && $H < 18) {$NT = 'DAY';}
		else {$NT = 'EVENING';}
		$Select = implode(',', array($NT.'_T', $NT.'_P', $NT.'_WET', $NT.'_CLOUDY', $NT.'_RAIN', $NT.'_PHEN', $NT.'_S_WIND', $NT.'_D_WIND'));
		$Weather = $this->MySQL->Select('SELECT '.$Select.' FROM `{p}weathers` WHERE `CITY_ID` = '.$Params['city_id'].' AND `DATE` = "'.date('Y-m-d').'"');
		$City = $this->MySQL->Select('SELECT `URL`, `NAME` FROM `{p}cities` `c` INNER JOIN `{p}urls` `u` ON `u`.`ID` = `c`.`ID` AND `URL_TYPE` = 3 WHERE `c`.`ID` = '.$Params['city_id']);
		echo "function Informer_",$Params["ID"],"() {var h=false;var e=null;var c=null;var f=0;function k(){c=typeof($)!==\"undefined\"?$:null;if(window.jQuery===\"undefined\"||window.jQuery===undefined){_cl_",$Params["ID"],"=function(){h=true;var n=document.createElement(\"script\");n.setAttribute(\"type\",\"text/javascript\");n.setAttribute(\"src\",\"http://www.weather.by/js/jquery.js\");n.setAttribute(\"id\",\"scr\"+g);n.onload=j;if(document.documentMode!=9){n.onreadystatechange=function(){if(this.readyState==\"complete\"||this.readyState==\"loaded\"){j()}}}(document.getElementsByTagName(\"head\")[0]||document.documentElement).appendChild(n)};if(c!==null){window.onload=_cl_",$Params["ID"],"}else{_cl_",$Params["ID"],"()}}else{e=window.jQuery;i(e)}function j(){e=window.jQuery;if(window.jQuery.browser.msie){}else{delete window.jQuery}$=c;i(e)}function i(n){var elem = n(\"#weathInfID-".$Params["ID"]."\");elem.html('";
		echo '<div id="weathInf"><table class="weathInf" width="',$Params['width'],'">';
		if ($Params['city'] == 'true') {echo'<tr class="top_block"><td colspan="3"><a class="Link City" href="http://wwww.pogoda',$City['URL'],'"><strong>',$City['NAME'],'</strong></a></td></tr>';}
		echo '<tr class="mid_block" valign="top"><td style="padding-right:5px">';
		if ($Params['icons'] == 'true') {echo'<img src="http://www.weather.by/images/icons/',$s,'.',$Weather[$NT.'_CLOUDY'],'.',$Weather[$NT.'_RAIN'],'.',$Weather[$NT.'_PHEN'],'.png"  alt="',($this->Language->CLOUDYArray[$Weather[$NT.'_CLOUDY']]),(($Weather[$NT.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$Weather[$NT.'_RAIN']]:''),(($Weather[$NT.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$Weather[$NT.'_PHEN']]:''),'" />';}
		echo '</td><td style="padding-right:5px" class="t_block">';
		if ($Params['t'] == 'true') {echo '<span class="TValue">',($Weather[$NT.'_T'] > 0)?'+':'',$Weather[$NT.'_T'],'<span class="Unit Cels">°C</span></span>';}
		echo '</td><td>';
		if ($Params['s_wind'] == 'true') {echo '<div class="weather"><span class="Value">',$Weather[$NT.'_S_WIND'],'</span><span class="Unit"> м/с</span></div>';}
		if ($Params['p'] == 'true') {echo '<div class="weather"><span class="Value">',$Weather[$NT.'_P'],'</span><span class="Unit"> мм рт.ст.</span></div>';}
		if ($Params['wet'] == 'true') {echo '<div class="weather"><span class="Value">',$Weather[$NT.'_WET'],'</span><span class="Unit"> % влажн.</span></div>';}
		echo '</td></tr>';
		if ($Params['opis']) {echo'<tr class="mid_block mid_border"><td colspan="3"><span class="Opis">',($this->Language->CLOUDYArray[$Weather[$NT.'_CLOUDY']]),(($Weather[$NT.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$Weather[$NT.'_RAIN']]:''),(($Weather[$NT.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$Weather[$NT.'_PHEN']]:''),'</span></td></tr>';}
		echo '<tr class="bot_block"><td colspan="3"><a style="float:left" href="http://www.weather.by/"><img src="http://www.weather.by/images/weather_logo.png" width="99" height="20" alt="Weather.by" /></a> <a style="float:right" class="Link" href="http://www.weather.by',$City['URL'],'">Погода</a></td></tr></table></div>';
		echo "');";
		echo '$(".mid_block:last").addClass("mid_border");';
		echo '$("#weathInf .weathInf").css({width: "',$Params['width'],'px"});';
		echo '$("#weathInf").css({width: "',$Params['width'],'px", backgroundColor: "',$Params['background'],'"',($Params['border_check'] == 'true')?', border:"1px '.$Params['border_type'].' '.$Params['border'].'"':'','});';
		echo '$("#weathInf .top_block").css({backgroundColor: "',$Params['top_back'],'"',($Params['top_border_c'] == 'true')?', borderBottom:"1px '.$Params['top_border_type'].' '.$Params['top_border'].'"':'','});';
		echo '$("#weathInf .mid_block").css({backgroundColor: "',$Params['mid_back'],'"});';
		if ($Params['mid_border_c'] == 'true'){echo '$("#weathInf .mid_border").css({borderBottom:"1px ',$Params['mid_border_type'],' ',$Params['mid_border'],'"});';}
		echo '$("#weathInf .bot_block").css({backgroundColor: "',$Params['bot_back'],'"});';
		echo '$("#weathInf .TValue").css({color: "',$Params['t_color'],'"});';
		echo '$("#weathInf .Value").css({color: "',$Params['val_color'],'"});';
		echo '$("#weathInf .Opis").css({color: "',$Params['opis_color'],'"});';
		echo '$("#weathInf .Unit").css({color: "',$Params['unit_color'],'"});';
		echo '$("#weathInf .Link").css({color: "',$Params['a_color'],'"});';
		echo "}}k();}Informer_",$Params["ID"],"();";
	}
	private function Informer_2(&$Params) {
		$NT = 'NIGHT';$H = (int)date('H');
		$s = 's';
		if ($H >= 0 && $H < 6) {$NT = 'NIGHT';$s = 'n';}
		elseif ($H >= 6 && $H < 12) {$NT = 'MORNING';}
		elseif ($H >= 12 && $H < 18) {$NT = 'DAY';}
		else {$NT = 'EVENING';}
		$Weather = $this->MySQL->Select('SELECT * FROM `{p}weathers` WHERE `CITY_ID` = '.$Params['city_id'].' AND `DATE` = "'.date('Y-m-d').'"');
		$City = $this->MySQL->Select('SELECT `URL`, `NAME` FROM `{p}cities` `c` INNER JOIN `{p}urls` `u` ON `u`.`ID` = `c`.`ID` AND `URL_TYPE` = 3 WHERE `c`.`ID` = '.$Params['city_id']);
		echo "function Informer_",$Params["ID"],"() {var h=false;var e=null;var c=null;var f=0;function k(){c=typeof($)!==\"undefined\"?$:null;if(window.jQuery===\"undefined\"||window.jQuery===undefined){_cl_",$Params["ID"],"=function(){h=true;var n=document.createElement(\"script\");n.setAttribute(\"type\",\"text/javascript\");n.setAttribute(\"src\",\"http://www.weather.by/js/jquery.js\");n.setAttribute(\"id\",\"scr\"+g);n.onload=j;if(document.documentMode!=9){n.onreadystatechange=function(){if(this.readyState==\"complete\"||this.readyState==\"loaded\"){j()}}}(document.getElementsByTagName(\"head\")[0]||document.documentElement).appendChild(n)};if(c!==null){window.onload=_cl_",$Params["ID"],"}else{_cl_",$Params["ID"],"()}}else{e=window.jQuery;i(e)}function j(){e=window.jQuery;if(window.jQuery.browser.msie){}else{delete window.jQuery}$=c;i(e)}function i(n){var elem = n(\"#weathInfID-".$Params["ID"]."\");elem.html('";
		echo '<div id="weathInf"><table class="weathInf" width="',$Params['width'],'">';
		if ($Params['city'] == 'true') {echo'<tr class="top_block"><td valign="center"><a class="City Link" href="http://www.weather.by',$City['URL'],'"><strong>',$City['NAME'],'</strong></a></td><td align="center"><img class="icons_block" src="http://www.weather.by/images/icons/',$s,'.',$Weather[$NT.'_CLOUDY'],'.',$Weather[$NT.'_RAIN'],'.',$Weather[$NT.'_PHEN'],'"  alt="',($this->Language->CLOUDYArray[$Weather[$NT.'_CLOUDY']]),(($Weather[$NT.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$Weather[$NT.'_RAIN']]:''),(($Weather[$NT.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$Weather[$NT.'_PHEN']]:''),'" /></td><td valign="center" align="right"><span class="TValue t_block">',($Weather[$NT.'_T'] > 0)?'+':'',$Weather[$NT.'_T'],'</span></td></tr>';}
		if ($Params['opis']) {echo'<tr><td colspan="3" align="center"><span class="Opis">',($this->Language->CLOUDYArray[$Weather[$NT.'_CLOUDY']]),(($Weather[$NT.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$Weather[$NT.'_RAIN']]:''),(($Weather[$NT.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$Weather[$NT.'_PHEN']]:''),'</span></td></tr>';}
		echo '</table><table class="weathInf" width="',$Params['width'],'"><tr align="center" class="mid_block"><td width="25%"><span class="Text">Ночь</td><td width="25%"><span class="Text">Утро</span></td><td width="25%"><span class="Text">День</span></span></td><td width="25%"><span class="Text">Вечер</span></td></tr>';
		if ($Params['icons'] == 'true') {
			echo'<tr align="center" class="mid_block">';
			foreach ($this->Language->TimesArray as $Index => $Value) {
				echo '<td><img src="http://www.weather.by/images/icons/',$s,'.',$Weather[$Index.'_CLOUDY'],'.',$Weather[$Index.'_PHEN'],'.',$Weather[$Index.'_PHEN'],'.png" width="30" height="30" alt="',($this->Language->CLOUDYArray[$Weather[$Index.'_CLOUDY']]),(($Weather[$Index.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$Weather[$Index.'_RAIN']]:''),(($Weather[$Index.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$Weather[$Index.'_PHEN']]:''),'" /></td>';
			}
			echo '</tr>';
		}
		if ($Params['t'] == 'true') {
			echo '<tr align="center" class="mid_block">';
			foreach ($this->Language->TimesArray as $Index => $Value) {
				echo '<td><span class="TValue">',($Weather[$Index.'_T'] > 0)?'+':'',$Weather[$Index.'_T'],'</span></td>';
			}
			echo '</tr>';
		}
		if ($Params['s_wind'] == 'true') {
			echo '<tr align="center" class="mid_block">';
			foreach ($this->Language->TimesArray as $Index => $Value) {
				echo '<td><span class="Value">',$Weather[$Index.'_S_WIND'],'</span><span class="Unit"> м/с</span></td>';
			}
			echo '</tr>';
		}
		if ($Params['p'] == 'true') {
			echo '<tr align="center" class="mid_block">';
			foreach ($this->Language->TimesArray as $Index => $Value) {
				echo '<td><span class="Value">',$Weather[$Index.'_P'],'</span></td>';
			}
			echo '</tr>';
		}
		if ($Params['wet'] == 'true') {
			echo '<tr align="center" class="mid_block">';
			foreach ($this->Language->TimesArray as $Index => $Value) {
				echo '<td><span class="Value">',$Weather[$Index.'_WET'],'</span><span class="Unit"> %</span></td>';
			}
			echo '</tr>';
		}
		echo '<tr class="bot_block"><td colspan="4"><a style="float:left" href="http://www.weather.by/"><img src="http://www.weather.by/images/weather_logo.png" width="99" height="20" alt="Weather.by" /></a> <a style="float:right" class="Link" href="http://www.weather.by',$City['URL'],'">Погода</a></td></tr></table></div>';
		echo "');";
		echo '$(".mid_block:last").addClass("mid_border");';
		echo '$("#weathInf").css({width: "',$Params['width'],'px", backgroundColor: "',$Params['background'],'"',($Params['border_check'] == 'true')?', border:"1px '.$Params['border_type'].' '.$Params['border'].'"':'','});';
		echo '$("#weathInf .weathInf").css({width: "',$Params['width'],'px", backgroundColor: "',$Params['background'],'"});';
		echo '$("#weathInf .top_block").css({backgroundColor: "',$Params['top_back'],'"',($Params['top_border_c'] == 'true')?', borderBottom:"1px '.$Params['top_border_type'].' '.$Params['top_border'].'"':'','});';
		echo '$("#weathInf .mid_block").css({backgroundColor: "',$Params['mid_back'],'"});';
		if ($Params['mid_border_c'] == 'true'){echo '$("#weathInf .mid_border").css({borderBottom:"1px ',$Params['mid_border_type'],' ',$Params['mid_border'],'"});';}
		echo '$("#weathInf .bot_block").css({backgroundColor: "',$Params['bot_back'],'"});';
		echo '$("#weathInf .TValue").css({color: "',$Params['t_color'],'"});';
		echo '$("#weathInf .Value").css({color: "',$Params['val_color'],'"});';
		echo '$("#weathInf .Opis").css({color: "',$Params['opis_color'],'"});';
		echo '$("#weathInf .Text").css({color: "',$Params['text_color'],'"});';
		echo '$("#weathInf .Unit").css({color: "',$Params['unit_color'],'"});';
		echo '$("#weathInf .Link").css({color: "',$Params['a_color'],'"});';
		echo "}}k();}Informer_",$Params["ID"],"();";
	}
	private function Informer_3(&$Params) {
		$NT = 'NIGHT';$H = (int)date('H');
		$s = 's';
		if ($H >= 0 && $H < 6) {$NT = 'NIGHT';$s = 'n';}
		elseif ($H >= 6 && $H < 12) {$NT = 'MORNING';}
		elseif ($H >= 12 && $H < 18) {$NT = 'DAY';}
		else {$NT = 'EVENING';}
		$Select = implode(',', array($NT.'_T', $NT.'_P', $NT.'_WET', $NT.'_CLOUDY', $NT.'_RAIN', $NT.'_PHEN', $NT.'_S_WIND', $NT.'_D_WIND'));
		$Weather = $this->MySQL->Select('SELECT '.$Select.' FROM `{p}weathers` WHERE `CITY_ID` = '.$Params['city_id'].' AND `DATE` = "'.date('Y-m-d').'"');
		$City = $this->MySQL->Select('SELECT `URL`, `NAME` FROM `{p}cities` `c` INNER JOIN `{p}urls` `u` ON `u`.`ID` = `c`.`ID` AND `URL_TYPE` = 3 WHERE `c`.`ID` = '.$Params['city_id']);
		echo "function Informer_",$Params["ID"],"() {var h=false;var e=null;var c=null;var f=0;function k(){c=typeof($)!==\"undefined\"?$:null;if(window.jQuery===\"undefined\"||window.jQuery===undefined){_cl_",$Params["ID"],"=function(){h=true;var n=document.createElement(\"script\");n.setAttribute(\"type\",\"text/javascript\");n.setAttribute(\"src\",\"http://www.weather.by/js/jquery.js\");n.setAttribute(\"id\",\"scr\"+g);n.onload=j;if(document.documentMode!=9){n.onreadystatechange=function(){if(this.readyState==\"complete\"||this.readyState==\"loaded\"){j()}}}(document.getElementsByTagName(\"head\")[0]||document.documentElement).appendChild(n)};if(c!==null){window.onload=_cl_",$Params["ID"],"}else{_cl_",$Params["ID"],"()}}else{e=window.jQuery;i(e)}function j(){e=window.jQuery;if(window.jQuery.browser.msie){}else{delete window.jQuery}$=c;i(e)}function i(n){var elem = n(\"#weathInfID-".$Params["ID"]."\");elem.html('";
		echo '<div id="weathInf"><table class="weathInf" width="',$Params['width'],'">';
		if ($Params['city'] == 'true') {echo'<tr class="top_block"><td align="center"><a class="Link City" href="http://wwww.pogoda',$City['URL'],'"><strong>',$City['NAME'],'</strong></a></td></tr>';}
		if ($Params['t'] == 'true') {echo '<tr><td align="center"><span class="TValue">',($Weather[$NT.'_T'] > 0)?'+':'',$Weather[$NT.'_T'],'<span class="Unit Cels">°C</span></span></td></tr>';}
		if ($Params['opis']) {echo'<tr class="mid_block"><td align="center"><span class="Opis">',($this->Language->CLOUDYArray[$Weather[$NT.'_CLOUDY']]),(($Weather[$NT.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$Weather[$NT.'_RAIN']]:''),(($Weather[$NT.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$Weather[$NT.'_PHEN']]:''),'</span></td></tr>';}
		if ($Params['s_wind'] == 'true') {echo '<tr class="mid_block"><td align="center"><span class="Value">',$Weather[$NT.'_S_WIND'],'</span><span class="Unit"> м/с</span></td></tr>';}
		if ($Params['p'] == 'true') {echo '<tr class="mid_block"><td align="center"><span class="Value">',$Weather[$NT.'_P'],'</span><span class="Unit"> мм рт.ст.</span></td></tr>';}
		if ($Params['wet'] == 'true') {echo '<tr class="mid_block"><td align="center"><span class="Value">',$Weather[$NT.'_WET'],'</span><span class="Unit"> % влажн.</span></td></tr>';}
		echo '<tr class="bot_block"><td><a href="http://www.weather.by/"><img src="http://www.weather.by/images/weather_logo.png" width="99" height="20" alt="Weather.by" /></a></td></tr></table></div>';
		echo "');";
		echo '$(".mid_block:last").addClass("mid_border");';
		echo '$("#weathInf .weathInf").css({width: "',$Params['width'],'px"});';
		echo '$("#weathInf").css({width: "',$Params['width'],'px", backgroundColor: "',$Params['background'],'"',($Params['border_check'] == 'true')?', border:"1px '.$Params['border_type'].' '.$Params['border'].'"':'','});';
		echo '$("#weathInf .top_block").css({backgroundColor: "',$Params['top_back'],'"',($Params['top_border_c'] == 'true')?', borderBottom:"1px '.$Params['top_border_type'].' '.$Params['top_border'].'"':'','});';
		echo '$("#weathInf .mid_block").css({backgroundColor: "',$Params['mid_back'],'"});';
		if ($Params['mid_border_c'] == 'true'){echo '$("#weathInf .mid_border").css({borderBottom:"1px ',$Params['mid_border_type'],' ',$Params['mid_border'],'"});';}
		echo '$("#weathInf .bot_block").css({backgroundColor: "',$Params['bot_back'],'"});';
		echo '$("#weathInf .TValue").css({color: "',$Params['t_color'],'"});';
		echo '$("#weathInf .Value").css({color: "',$Params['val_color'],'"});';
		echo '$("#weathInf .Opis").css({color: "',$Params['opis_color'],'"});';
		echo '$("#weathInf .Unit").css({color: "',$Params['unit_color'],'"});';
		echo '$("#weathInf .Link").css({color: "',$Params['a_color'],'"});';
		echo "}}k();}Informer_",$Params["ID"],"();";
	}
	private function Informer_4(&$Params) {
		$NT = 'NIGHT';$H = (int)date('H');
		$s = 's';
		if ($H >= 0 && $H < 6) {$NT = 'NIGHT';$s = 'n';}
		elseif ($H >= 6 && $H < 12) {$NT = 'MORNING';}
		elseif ($H >= 12 && $H < 18) {$NT = 'DAY';}
		else {$NT = 'EVENING';}
		$Select = implode(',', array($NT.'_T', $NT.'_P', $NT.'_WET', $NT.'_CLOUDY', $NT.'_RAIN', $NT.'_PHEN', $NT.'_S_WIND', $NT.'_D_WIND'));
		$Weather = $this->MySQL->Select('SELECT '.$Select.' FROM `{p}weathers` WHERE `CITY_ID` = '.$Params['city_id'].' AND `DATE` = "'.date('Y-m-d').'"');
		$City = $this->MySQL->Select('SELECT `URL`, `NAME` FROM `{p}cities` `c` INNER JOIN `{p}urls` `u` ON `u`.`ID` = `c`.`ID` AND `URL_TYPE` = 3 WHERE `c`.`ID` = '.$Params['city_id']);
		echo "function Informer_",$Params["ID"],"() {var h=false;var e=null;var c=null;var f=0;function k(){c=typeof($)!==\"undefined\"?$:null;if(window.jQuery===\"undefined\"||window.jQuery===undefined){_cl_",$Params["ID"],"=function(){h=true;var n=document.createElement(\"script\");n.setAttribute(\"type\",\"text/javascript\");n.setAttribute(\"src\",\"http://www.weather.by/js/jquery.js\");n.setAttribute(\"id\",\"scr\"+g);n.onload=j;if(document.documentMode!=9){n.onreadystatechange=function(){if(this.readyState==\"complete\"||this.readyState==\"loaded\"){j()}}}(document.getElementsByTagName(\"head\")[0]||document.documentElement).appendChild(n)};if(c!==null){window.onload=_cl_",$Params["ID"],"}else{_cl_",$Params["ID"],"()}}else{e=window.jQuery;i(e)}function j(){e=window.jQuery;if(window.jQuery.browser.msie){}else{delete window.jQuery}$=c;i(e)}function i(n){var elem = n(\"#weathInfID-".$Params["ID"]."\");elem.html('";
		echo '<div id="weathInf"><table class="weathInf" width="',$Params['width'],'">';
		if ($Params['city'] == 'true') {echo'<tr class="top_block"><td valign="center"><a class="City Link" href="http://www.weather.by',$City['URL'],'"><strong>',$City['NAME'],'</strong></a></td>';
			if ($Params['icons'] == 'true') {echo '<td align="center"><img src="http://www.weather.by/images/icons/',$s,'.',$Weather[$NT.'_CLOUDY'],'.',$Weather[$NT.'_RAIN'],'.',$Weather[$NT.'_PHEN'],'.png"  alt="',($this->Language->CLOUDYArray[$Weather[$NT.'_CLOUDY']]),(($Weather[$NT.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$Weather[$NT.'_RAIN']]:''),(($Weather[$NT.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$Weather[$NT.'_PHEN']]:''),'" /></td>';}
			if ($Params['t'] == 'true') {echo '<td align="right"><span class="TValue">',($Weather[$NT.'_T'] > 0)?'+':'',$Weather[$NT.'_T'],' °C</span></td></tr>';}
		}
		echo '<tr><td colspan="3" align="center" class="mid_block mid_border">';
		if ($Params['opis']) {echo'<span class="Opis">',($this->Language->CLOUDYArray[$Weather[$NT.'_CLOUDY']]),(($Weather[$NT.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$Weather[$NT.'_RAIN']]:''),(($Weather[$NT.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$Weather[$NT.'_PHEN']]:''),'</span><br />';}
		if ($Params['s_wind'] == 'true') {echo '<span class="Value">',$Weather[$NT.'_S_WIND'],'</span><span class="Unit"> м/с</span>';}
		if ($Params['p'] == 'true') {echo '<span class="Value">',$Weather[$NT.'_P'],'</span><span class="Unit"> мм рт.ст.</span>';}
		if ($Params['wet'] == 'true') {echo '<span class="Value">',$Weather[$NT.'_WET'],'</span><span class="Unit"> % влажн.</span>';}
		echo '</td></tr><tr class="bot_block"><td colspan="3"><a style="float:left" href="http://www.weather.by/"><img src="http://www.weather.by/images/weather_logo.png" width="99" height="20" alt="Weather.by" /></a> <a style="float:right" class="Link" href="http://www.weather.by',$City['URL'],'">Погода</a></td></tr></table></div>';
		echo "');";
		echo '$("#weathInf .weathInf").css({width: "',$Params['width'],'px"});';
		echo '$("#weathInf").css({width: "',$Params['width'],'px", backgroundColor: "',$Params['background'],'"',($Params['border_check'] == 'true')?', border:"1px '.$Params['border_type'].' '.$Params['border'].'"':'','});';
		echo '$("#weathInf .top_block").css({backgroundColor: "',$Params['top_back'],'"',($Params['top_border_c'] == 'true')?', borderBottom:"1px '.$Params['top_border_type'].' '.$Params['top_border'].'"':'','});';
		echo '$("#weathInf .mid_block").css({backgroundColor: "',$Params['mid_back'],'"});';
		if ($Params['mid_border_c'] == 'true'){echo '$("#weathInf .mid_border").css({borderBottom:"1px ',$Params['mid_border_type'],' ',$Params['mid_border'],'"});';}
		echo '$("#weathInf .bot_block").css({backgroundColor: "',$Params['bot_back'],'"});';
		echo '$("#weathInf .TValue").css({color: "',$Params['t_color'],'"});';
		echo '$("#weathInf .Value").css({color: "',$Params['val_color'],'"});';
		echo '$("#weathInf .Opis").css({color: "',$Params['opis_color'],'"});';
		echo '$("#weathInf .Unit").css({color: "',$Params['unit_color'],'"});';
		echo '$("#weathInf .Link").css({color: "',$Params['a_color'],'"});';
		echo "}}k();}Informer_",$Params["ID"],"();";
	}
	private function Informer_5(&$Params) {
		$NT = 'NIGHT';$H = (int)date('H');
		$s = 's';
		if ($H >= 0 && $H < 6) {$NT = 'NIGHT';$s = 'n';}
		elseif ($H >= 6 && $H < 12) {$NT = 'MORNING';}
		elseif ($H >= 12 && $H < 18) {$NT = 'DAY';}
		else {$NT = 'EVENING';}
		$Select = implode(',', array($NT.'_T', $NT.'_P', $NT.'_WET', $NT.'_CLOUDY', $NT.'_RAIN', $NT.'_PHEN', $NT.'_S_WIND', $NT.'_D_WIND'));
		$Weather = $this->MySQL->Select('SELECT '.$Select.' FROM `{p}weathers` WHERE `CITY_ID` = '.$Params['city_id'].' AND `DATE` = "'.date('Y-m-d').'"');
		$City = $this->MySQL->Select('SELECT `URL`, `NAME` FROM `{p}cities` `c` INNER JOIN `{p}urls` `u` ON `u`.`ID` = `c`.`ID` AND `URL_TYPE` = 3 WHERE `c`.`ID` = '.$Params['city_id']);
		echo "function Informer_",$Params["ID"],"() {var h=false;var e=null;var c=null;var f=0;function k(){c=typeof($)!==\"undefined\"?$:null;if(window.jQuery===\"undefined\"||window.jQuery===undefined){_cl_",$Params["ID"],"=function(){h=true;var n=document.createElement(\"script\");n.setAttribute(\"type\",\"text/javascript\");n.setAttribute(\"src\",\"http://www.weather.by/js/jquery.js\");n.setAttribute(\"id\",\"scr\"+g);n.onload=j;if(document.documentMode!=9){n.onreadystatechange=function(){if(this.readyState==\"complete\"||this.readyState==\"loaded\"){j()}}}(document.getElementsByTagName(\"head\")[0]||document.documentElement).appendChild(n)};if(c!==null){window.onload=_cl_",$Params["ID"],"}else{_cl_",$Params["ID"],"()}}else{e=window.jQuery;i(e)}function j(){e=window.jQuery;if(window.jQuery.browser.msie){}else{delete window.jQuery}$=c;i(e)}function i(n){var elem = n(\"#weathInfID-".$Params["ID"]."\");elem.html('";
		echo '<div id="weathInf"><table class="weathInf" width="',$Params['width'],'">';
		if ($Params['city'] == 'true') {echo'<tr class="top_block"><td colspan="2" valign="center"><a class="City Link" href="http://www.weather.by',$City['URL'],'"><strong>',$City['NAME'],'</strong></a></td></tr>';}
		echo '<tr>';
		if ($Params['icons'] == 'true') {echo '<td align="right"><img src="http://www.weather.by/images/icons/',$s,'.',$Weather[$NT.'_CLOUDY'],'.',$Weather[$NT.'_RAIN'],'.',$Weather[$NT.'_PHEN'],'.png"  alt="',($this->Language->CLOUDYArray[$Weather[$NT.'_CLOUDY']]),(($Weather[$NT.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$Weather[$NT.'_RAIN']]:''),(($Weather[$NT.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$Weather[$NT.'_PHEN']]:''),'" /></td>';}
		if ($Params['t'] == 'true') {echo '<td align="left"><span class="TValue">',($Weather[$NT.'_T'] > 0)?'+':'',$Weather[$NT.'_T'],' °C</span></td>';}
		echo '</tr><tr><td colspan="3" align="center" class="mid_block mid_border">';
		if ($Params['opis']) {echo'<span class="Opis">',($this->Language->CLOUDYArray[$Weather[$NT.'_CLOUDY']]),(($Weather[$NT.'_RAIN'] != 0)?', '.$this->Language->RAINArray[$Weather[$NT.'_RAIN']]:''),(($Weather[$NT.'_PHEN'] != 0)?', '.$this->Language->PHENArray[$Weather[$NT.'_PHEN']]:''),'</span><br />';}
		if ($Params['s_wind'] == 'true') {echo '<span class="Value">',$Weather[$NT.'_S_WIND'],'</span><span class="Unit"> м/с</span>';}
		if ($Params['p'] == 'true') {echo '<span class="Value">',$Weather[$NT.'_P'],'</span><span class="Unit"> мм рт.ст.</span>';}
		if ($Params['wet'] == 'true') {echo '<span class="Value">',$Weather[$NT.'_WET'],'</span><span class="Unit"> % влажн.</span>';}
		echo '</td></tr><tr class="bot_block"><td colspan="3"><a style="float:left" href="http://www.weather.by/"><img src="http://www.weather.by/images/weather_logo.png" width="99" height="20" alt="Weather.by" /></a> <a style="float:right" class="Link" href="http://www.weather.by',$City['URL'],'">Погода</a></td></tr></table></div>';
		echo "');";
		echo '$("#weathInf .weathInf").css({width: "',$Params['width'],'px"});';
		echo '$("#weathInf").css({width: "',$Params['width'],'px", backgroundColor: "',$Params['background'],'"',($Params['border_check'] == 'true')?', border:"1px '.$Params['border_type'].' '.$Params['border'].'"':'','});';
		echo '$("#weathInf .top_block").css({backgroundColor: "',$Params['top_back'],'"',($Params['top_border_c'] == 'true')?', borderBottom:"1px '.$Params['top_border_type'].' '.$Params['top_border'].'"':'','});';
		echo '$("#weathInf .mid_block").css({backgroundColor: "',$Params['mid_back'],'"});';
		if ($Params['mid_border_c'] == 'true'){echo '$("#weathInf .mid_border").css({borderBottom:"1px ',$Params['mid_border_type'],' ',$Params['mid_border'],'"});';}
		echo '$("#weathInf .bot_block").css({backgroundColor: "',$Params['bot_back'],'"});';
		echo '$("#weathInf .TValue").css({color: "',$Params['t_color'],'"});';
		echo '$("#weathInf .Value").css({color: "',$Params['val_color'],'"});';
		echo '$("#weathInf .Opis").css({color: "',$Params['opis_color'],'"});';
		echo '$("#weathInf .Unit").css({color: "',$Params['unit_color'],'"});';
		echo '$("#weathInf .Link").css({color: "',$Params['a_color'],'"});';
		echo "}}k();}Informer_",$Params["ID"],"();";
	}
}
?>